www.gusucode.com > Simulink Onramp 工具箱matlab源码程序 > Simulink Onramp/R2018b/web/academyinteractions/SimulinkTaskPaneApp.js

    //>>built
require({cache:{"academyinteractions/InteractionService":function(){define("dojo/_base/declare dojo/_base/lang dojo/on dojo/Evented dojo/string dojo/Deferred mw-log/Log academyinteractions/InteractionLoader".split(" "),function(g,l,d,e,f,h,c,b){return g([e],{INTERACTION_STATES:{INACTIVE:"inactive",INITIALIZING:"initializing",GRADING:"grading",EVALUATING_SUBMISSION:"evaluating_submission",ALLOWING_USER_TO_PONDER_RESPONSE:"allowing_user_to_ponder_response",MOVING_TO_ANOTHER_QUESTION:"moving_to_another_question",
AWAITING_MOVE_TO_NEXT_QUESTION:"awaiting_move_to_next_question",COMPLETE:"complete"},INTERACTION_STATE_TIMEOUTS:{INACTIVE:null,INITIALIZING:5E4,GRADING:null,EVALUATING_SUBMISSION:3E4,ALLOWING_USER_TO_PONDER_RESPONSE:null,MOVING_TO_ANOTHER_QUESTION:2E4,AWAITING_MOVE_TO_NEXT_QUESTION:null,COMPLETE:null},RESPONSE_STATES:{CORRECT:"correct",INCORRECT:"incorrect",NOT_AVAILABLE:"not_available"},SKIP_STATES:{ALLOWED:"allowed",NOT_ALLOWED:"not_allowed"},STRUGGLING_STATES:{NOT_AVAILABLE:"not_available",STRUGGLING:"struggling",
REALLY_STRUGGLING:"really_struggling"},EVENTS:{USER_WANTS_TO_SKIP:"user_wants_to_skip",USER_WANTS_TO_SEE_SOLUTION:"user_wants_to_see_solution",USER_WANTS_TO_RESET:"user_wants_to_reset",USER_WANTS_TO_SEE_HINT:"display_default_hint",USER_WANTS_TO_MOVE_TO_NEXT_SECTION:"user_wants_to_move_to_next_section",SUBMISSION_GRADED:"submission_graded",DISPLAY_TASK:"display_question",INTERACTION_STATE_CHANGE:"interaction_state_change",RESPONSE_STATE_CHANGE:"response_state_change",SKIP_STATE_CHANGE:"skip_state_change",
STRUGGLING_STATE_CHANGE:"struggling_state_change",DISPLAY_SUPPORTING_INFO:"display_supporting_info",UPDATE_INTERNAL_PROGRESS:"update_internal_progress",INTERRUPT_REQUEST:"interrupt_request",STATE_CHANGES_UNRESPONSIVE:"state_changes_unresponsive",VIEWING_TASK:"viewing_task"},interactionState:null,responseState:null,skipState:null,strugglingState:null,currentTask:null,currentTaskNumber:null,_numFailedAttempts:0,_filesAdded:!1,_internalProgress:0,_numStateChangeFailures:0,_registeredTasks:{},opts:{},
constructor:function(a){this.interactionState=this.INTERACTION_STATES.INACTIVE;this.responseState=this.RESPONSE_STATES.NOT_AVAILABLE;this.skipState=this.SKIP_STATES.NOT_ALLOWED;this.strugglingState=this.STRUGGLING_STATES.NOT_AVAILABLE;this._interactionLoader=new b({interactionService:this})},registerTaskType:function(a,b){this._registeredTasks[a]=b},deregisterTaskType:function(a){delete this._registeredTasks[a]},getRegisteredTaskService:function(a){return this._registeredTasks[a]},clearInteractionData:function(){this._setInteractionState(this.INTERACTION_STATES.INACTIVE);
this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE);this._setSkipState(this.SKIP_STATES.NOT_ALLOWED);this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE);this._interaction=null;this._setCurrentTask(null);this._internalProgress=0},setInteractionData:function(a,b){this._setInteractionState(this.INTERACTION_STATES.INACTIVE);this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE);this._setSkipState(this.SKIP_STATES.NOT_ALLOWED);this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE);
this._interaction=this._interactionLoader.loadDataFromRawJson(a,b.fullPathToContent);this._setCurrentTask(null);this._internalProgress=0;this._updateTaskStatuses();this.opts=b?b:{}},startInteraction:function(a){this._internalProgress=a=this._ensureValidTaskNum(a);this._updateTaskStatuses();this._doStartInteraction(a)},_ensureValidTaskNum:function(a){a?1>a&&(a=1):a=1;return a},_doStartInteraction:function(a){a=this._ensureValidTaskNum(a);this._setInteractionState(this.INTERACTION_STATES.INITIALIZING);
this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE);this._setSkipState(this.SKIP_STATES.NOT_ALLOWED);this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE);this._numFailedAttempts=0;this._gotoTaskNumber(a)},resetToQuestionNumber:function(a){this._setCurrentTask(null);this._emitInterruptRequest();a=this._ensureValidTaskNum(a);this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE);this._setSkipState(this.SKIP_STATES.NOT_ALLOWED);this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE);
this._numFailedAttempts=0;this._gotoTaskNumber(a)},finishTheMoveToNextQuestion:function(){this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION?this._gotoNextTask():c.warn("Unable to honor request to move to next task")},repeatCurrentQuestion:function(){this.currentTask&&(this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?this._gotoTaskNumber(this.currentTaskNumber):
c.warn("Unable to honor request to repeat current question"))},_gotoNextTask:function(){var a;this.interactionState===this.INTERACTION_STATES.COMPLETE||this.interactionState===this.INTERACTION_STATES.INACTIVE||(a=null===this.currentTask?1:this.currentTaskNumber+1,this._gotoTaskNumber(a))},_gotoTaskNumber:function(a){var b=this.currentTask;this._setCurrentTask(this._interaction.tasks[a-1]);this._setInteractionState(this.INTERACTION_STATES.MOVING_TO_ANOTHER_QUESTION);b!==this.currentTask&&this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE)},
getTasks:function(){var a=null;this._interaction&&(a=this._interaction.tasks);return a},failedToMoveToCurrentQuestion:function(){this._updateStateTimeout();this.emit(this.EVENTS.STATE_CHANGES_UNRESPONSIVE,{id:this._getCurrentTaskId()})},successfullyMovedToCurrentQuestion:function(){this.interactionState!==this.INTERACTION_STATES.MOVING_TO_ANOTHER_QUESTION?c.warn("You cannot move to another question when interaction service is not in that state."):this.isLastTask(this.currentTask)?(this._setInteractionState(this.INTERACTION_STATES.COMPLETE),
this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE),this._setSkipState(this.SKIP_STATES.NOT_ALLOWED),this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE)):(this.currentTask.shouldShowSupportingInfo()&&(this.currentTask.setSupportingInfoDisplayedAlready(!0),this._emitSupportingInfoDisplay(this.currentTask.supportingInfo)),this._setInteractionState(this.INTERACTION_STATES.GRADING),this._updateSkipStateBasedOnAttemptFailures(),this._updateStrugglingStateBasedOnAttemptFailures())},_setCurrentTask:function(a){this.currentTask&&
this.currentTask===a||(this.currentTask&&this._registeredTasks[this.currentTask.type]&&this._registeredTasks[this.currentTask.type].disableTask(this.currentTask),a?(this.currentTask=a,this.currentTaskNumber=a.taskNumber):this.currentTaskNumber=this.currentTask=null,this.currentTask&&this._registeredTasks[this.currentTask.type]&&this._registeredTasks[this.currentTask.type].enableTask(this.currentTask),this._updateTaskStatuses())},isLastTask:function(a){return a===this._interaction.tasks[this._interaction.tasks.length-
1]},getNextTask:function(a){var b,c=null;if(this._interaction&&this._interaction.tasks)for(b=0;b<this._interaction.tasks.length;b++)a===this._interaction.tasks[b]&&this._interaction.tasks[b+1]&&(c=this._interaction.tasks[b+1]);return c},getPreviousTask:function(a){var b,c=null;if(this._interaction&&this._interaction.tasks)for(b=1;b<this._interaction.tasks.length;b++)a===this._interaction.tasks[b]&&this._interaction.tasks[b-1]&&(c=this._interaction.tasks[b-1]);return c},clearResponse:function(){this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE)},
_doProcessSubmission:function(){this.interactionState===this.INTERACTION_STATES.GRADING||this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?(this._setInteractionState(this.INTERACTION_STATES.EVALUATING_SUBMISSION),this._setResponseState(this.RESPONSE_STATES.NOT_AVAILABLE)):c.warn("Unable to honor request to process submission")},successfullyProcessedSubmission:function(){this.interactionState===
this.INTERACTION_STATES.EVALUATING_SUBMISSION?this._reactToProcessedSubmission():c.warn("Unable to recognize that submission was processed")},failedToProcessSubmission:function(){},userWantsToSubmit:function(){this.interactionState===this.INTERACTION_STATES.GRADING||this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?this._doProcessSubmission():c.warn("Unable to honor request to submit")},
userWantsToSkip:function(){this.interactionState===this.INTERACTION_STATES.GRADING||this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?this.emit(this.EVENTS.USER_WANTS_TO_SKIP,{id:this._getCurrentTaskId()}):c.warn("Unable to honor request to get solution")},userWantsToSeeSolution:function(){this.interactionState===this.INTERACTION_STATES.GRADING||this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||
this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?this.emit(this.EVENTS.USER_WANTS_TO_SEE_SOLUTION,{id:this._getCurrentTaskId()}):c.warn("Unable to honor request to see solution")},userWantsToReset:function(){this.interactionState===this.INTERACTION_STATES.GRADING||this.interactionState===this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionState===this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE?this.emit(this.EVENTS.USER_WANTS_TO_RESET,{id:this._getCurrentTaskId()}):
c.warn("Unable to honor request to reset code")},userWantsToSeeHint:function(){this.emit(this.EVENTS.USER_WANTS_TO_SEE_HINT,{id:this._getCurrentTaskId()})},userWantsToMoveToNextSection:function(){this.emit(this.EVENTS.USER_WANTS_TO_MOVE_TO_NEXT_SECTION)},getAddedFileData:function(a){var b=a;this._interaction.filesToAdd.forEach(function(c){c.name===a&&(b=c)},this);return b},isAllowedToSkip:function(){var a=!1;this.skipState===this.SKIP_STATES.ALLOWED&&(a=!0);return a},_reactToProcessedSubmission:function(){var a=
this.currentTask.isResponseCorrect();this.emit(this.EVENTS.SUBMISSION_GRADED,{id:this._getCurrentTaskId(),response:this.currentTask.getResponseSubmission(),question:this.currentTask.description,correct:a});a?(this._setResponseState(this.RESPONSE_STATES.CORRECT),this._setInteractionState(this.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION),this._updateInternalProgress(),this._numFailedAttempts=0,this._setSkipState(this.SKIP_STATES.ALLOWED),this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE)):
(this._setResponseState(this.RESPONSE_STATES.INCORRECT),this._setInteractionState(this.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE),this._numFailedAttempts++,this._updateSkipStateBasedOnAttemptFailures(),this._updateStrugglingStateBasedOnAttemptFailures())},_getCurrentTaskId:function(){return this._interaction.id+"\x26task\x3d"+this.currentTaskNumber},_updateSkipStateBasedOnAttemptFailures:function(){0<=this._numFailedAttempts?this._setSkipState(this.SKIP_STATES.ALLOWED):this._setSkipState(this.SKIP_STATES.NOT_ALLOWED)},
_updateStrugglingStateBasedOnAttemptFailures:function(){2>this._numFailedAttempts&&this._setStrugglingState(this.STRUGGLING_STATES.NOT_AVAILABLE);2<=this._numFailedAttempts&&4>this._numFailedAttempts&&this._setStrugglingState(this.STRUGGLING_STATES.STRUGGLING);4<=this._numFailedAttempts&&this._setStrugglingState(this.STRUGGLING_STATES.REALLY_STRUGGLING)},displayQuestionNumber:function(a){this.emit(this.EVENTS.DISPLAY_TASK,a)},_updateInternalProgress:function(){var a;a=this.currentTaskNumber;a+1>this._internalProgress&&
(this._internalProgress=a+1);this._updateTaskStatuses();this._emitUpdateInternalProgress(a+1)},getInternalProgress:function(){return this._internalProgress},allTasksCompleted:function(){var a=!1;this._interaction&&this._interaction.tasks&&this._internalProgress===this._interaction.tasks.length&&(a=!0);return a},_updateTaskStatuses:function(){var a,b,c;if(this._interaction&&this._interaction.tasks)for(a=0;a<this._interaction.tasks.length;a++)b=a+1,c=this._interaction.tasks[a],b<=this._internalProgress?
c.setStatus(c.STATUS.INACTIVE):c.setStatus(c.STATUS.NOTYETREACHED),b===this.currentTaskNumber&&c.setStatus(c.STATUS.ACTIVE)},isTaskComplete:function(a){return a.taskNumber<this._internalProgress},_stateTimeout:null,_updateStateTimeout:function(a){var b=this,c,e=null;this._stateTimeout&&(window.clearTimeout(this._stateTimeout),this._stateTimeout=null);for(c in this.INTERACTION_STATES)this.INTERACTION_STATES.hasOwnProperty(c)&&a===this.INTERACTION_STATES[c]&&this.INTERACTION_STATE_TIMEOUTS[c]&&(e=this.INTERACTION_STATE_TIMEOUTS[c]);
e&&(this._stateTimeout=window.setTimeout(function(){b.emit(b.EVENTS.STATE_CHANGES_UNRESPONSIVE,{id:b._getCurrentTaskId()})},e))},_setInteractionState:function(a){a!==this.interactionState&&(this.interactionState=a,this._updateStateTimeout(a),this.onInteractionStateChange())},onInteractionStateChange:function(){this.emit(this.EVENTS.INTERACTION_STATE_CHANGE,this.interactionState)},_setResponseState:function(a){this.responseState=a;this.onResponseStateChange()},onResponseStateChange:function(){this.emit(this.EVENTS.RESPONSE_STATE_CHANGE,
this.responseState)},_setSkipState:function(a){this.skipState=a;this.onSkipStateChange()},onSkipStateChange:function(){this.emit(this.EVENTS.SKIP_STATE_CHANGE,this.skipState)},_setStrugglingState:function(a){this.strugglingState=a;this.onStrugglingStateChange()},onStrugglingStateChange:function(){this.emit(this.EVENTS.STRUGGLING_STATE_CHANGE,this.strugglingState)},_emitSupportingInfoDisplay:function(a){this.emit(this.EVENTS.DISPLAY_SUPPORTING_INFO,a)},_emitUpdateInternalProgress:function(a){this.emit(this.EVENTS.UPDATE_INTERNAL_PROGRESS,
a)},_emitInterruptRequest:function(){this.emit(this.EVENTS.INTERRUPT_REQUEST)}})})},"academyinteractions/InteractionLoader":function(){define("dojo/_base/declare dojo/_base/lang dojo/string mw-log/Log academyinteractions/Task academyinteractions/util/MATLABPathUtil dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),function(g,l,d,e,f,h,c){return g([],{constructor:function(b){this.interactionService=b.interactionService},loadDataFromRawJson:function(b,a){return this._preprocessData(b,
a)},_preprocessData:function(b,a){var c={},d,m,f;f=h.getWorkFolder();var g=h.getFileSeparator();c.id=b.id;c.initializationCode=b.initializationCode;c.filesToAdd=this._unifyFilesToAddFormat(b);for(d=0;d<c.filesToAdd.length;d++)m=c.filesToAdd[d],c.filesToAdd[d].srcFile&&!this._containsProtocolAndDomain(c.filesToAdd[d].srcFile)&&(c.filesToAdd[d].srcFile=a+c.filesToAdd[d].srcFile),m.destPath=f+m.destPath,"\\"===g&&(m.destPath=m.destPath.replace(/\//g,"\\"));f={};for(d=0;d<b.questions.length;d++)m=b.questions[d],
m.template&&(m.prevSolution=f[m.template],f[m.template]=m.solution);c.tasks=[];for(d=0;d<b.questions.length;d++)m=b.questions[d],(f=this.interactionService.getRegisteredTaskService(m.type))&&f.createTaskFromRawData?c.tasks[d]=f.createTaskFromRawData({data:m,taskNumber:d+1}):e.warn("No task service registered for task type '"+m.type+"'");c.tasks.push(this._getCompletionTask(b));for(d=0;d<c.tasks.length-1;d++)c.tasks[d].nextTask=c.tasks[d+1];return c},_unifyFilesToAddFormat:function(b){var a=[];b.filesToAdd&&
b.filesToAdd.forEach(function(b){var c="noName.m",d,e=null,f=null;"string"===typeof b?(e=b,b=b.split("/"),c=b.pop(),f=null,d=c):b.name&&(c=b.name,d=b.destPath?b.destPath+"/"+c:c,b.srcFile&&(e=b.srcFile),b.contents&&(f=b.contents),!f&&!e&&(f=""),e&&(f=null),f&&"[object Array]"===Object.prototype.toString.call(f)&&(f=f.join("\n")));d||(d="");a.push({name:c,contents:f,srcFile:e,destPath:d})},this);return a},_getCompletionTask:function(b){var a,d,f=c.onComplete;b.completionText&&(f=b.completionText);
d=b.questions.length+1;b=null;(a=this.interactionService.getRegisteredTaskService("free"))&&a.createTaskFromRawData?b=a.createTaskFromRawData({data:{type:"free",description:f},taskNumber:d}):e.warn("No task service registered for task type 'free'.");return b},_containsProtocolAndDomain:function(b){return/(http|https):\/\/.*/.test(b)}})})},"academyinteractions/Task":function(){define(["dojo/_base/declare","mw-utils/Utils"],function(g,l){return g([],{STATUS:{ACTIVE:"active",INACTIVE:"inactive",NOTYETREACHED:"notyetreached"},
constructor:function(d){this.type=d.type;this.description=d.description;this.taskNumber=d.taskNumber;this.background=d.background;this.supportingInfo=d.supportingInfo;this.hint=d.hint;this._disabledActions={};this._hiddenActions={};this.uuid=l.generateUuid()},shouldShowSupportingInfo:function(){var d=!1;this.supportingInfo&&!this.supportingInfoDisplayedAlready&&(d=!0);return d},setSupportingInfoDisplayedAlready:function(d){this.supportingInfoDisplayedAlready=d},disableActionForTask:function(d){this._disabledActions[d]=
!0},enableActionForTask:function(d){delete this._disabledActions[d]},hideActionButtonForTask:function(d){this._hiddenActions[d]=!0},showActionButtonForTask:function(d){delete this._hiddenActions[d]},isActionDisabledForTask:function(d){var e=!1;this._disabledActions[d]&&(e=!0);return e},isActionHiddenForTask:function(d){var e=!1;this._hiddenActions[d]&&(e=!0);return e},setStatus:function(d){if(d===this.STATUS.ACTIVE||d===this.STATUS.INACTIVE||d===this.STATUS.NOTYETREACHED)this._status=d},getStatus:function(){return this._status},
clearResponse:function(){this._response=null},setResponse:function(d,e,f){this._response={};this._response.correct=d;this._response.submission=e;this._response.hint=f},isResponseCorrect:function(){var d=!1;this._response&&this._response.correct&&(d=!0);return d},getResponseSubmission:function(){return this._response.submission},getResponseHint:function(){return this._response.hint}})})},"academyinteractions/util/MATLABPathUtil":function(){define(["dojo/Deferred","mw-remote/Remote"],function(g,l){var d=
null,e="/tmp/",f=null,h=null,c=null;l.registerResponseHandler("EvalResponse:CurrentFolderPoll",function(b,a){h++;var k=b[0].responseStr.match(/[a-zA-Z\/\\0-9\:]*/)[0];if("/"===k[k.length-1]||"\\"===k[k.length-1])k=k.slice(0,-1);k&&"null"!==k?(-1!==k.indexOf("\\")?(k+="\\.training\\",c="\\"):(k+="/.training/",c="/"),1===h?d=k:e=k,2===h&&(f&&f.resolve(),h=null)):2===h&&(h=0,l.sendMessage({Eval:[{mcode:"disp(pwd)"},{mcode:"disp(tempdir)"}]},{},"CurrentFolderPoll"))},this);l.registerFaultHandler("EvalResponse:CurrentFolderPoll",
function(b,a){e=d=null;f&&f.resolve();h=0},this);return{acquireBasePath:function(){var b;f?b=f:(f=b=new g,b.promise.always(function(){f=null}),h=0,window.setTimeout(function(){f&&(f.isFulfilled()||f.cancel())},5E3),l.sendMessage({Eval:[{mcode:"disp(pwd)"},{mcode:"disp(tempdir)"}]},{},"CurrentFolderPoll"));return b.promise},unacquireBasePath:function(){e=d=null},getBasePath:function(){(null===d||"undefined"===typeof d)&&this.acquireBasePath();return d},getTestFolder:function(){var b=null;e&&(b=e+".tests/");
return b?b:"/tmp/"},getWorkFolder:function(){var b=null;d&&(b=d+".work/");return b?b:"/tmp/"},getFileSeparator:function(){return c}}})},"academyinteractions/SimulinkInteractionModule":function(){define("dojo/_base/declare dojo/Deferred dojo/Evented dojo/dom-class dojo/on dijit/layout/ContentPane mw-actiondataservice/ActionDataService academyinteractions/InteractionService academyinteractions/tasks/TaskActionProvider academyinteractions/Task academyinteractions/display/TaskNavigator academyinteractions/display/TaskQuickLinks academyinteractions/display/TaskDisplay academyinteractions/display/HintDisplay academyinteractions/display/SimulinkSolutionDisplay mw-academy-web/lecture/SimpleContentFormatter academyinteractions/MessageServiceInterface academyinteractions/toolEventCodes dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),
function(g,l,d,e,f,h,c,b,a,k,q,m,s,p,n,t,v,r,u){return g([d],{listeners:[],_taskList:[],_taskWidgets:[],constructor:function(a){this.interactionService=a.interactionService;this.actionService=a.actionService;this.taskActionService=a.taskActionService;this.taskActionProvider=a.taskActionProvider;this.taskNavigator=a.taskNavigator;this.messageServiceInterface=new v({subscribeChannel:"",publishChannel:"toolEventCodes"});this._createWidgets();this._addListeners()},_createWidgets:function(){var a=document.getElementById("taskPanePreloader");
a.parentNode.replaceChild(this.taskNavigator.domNode,a)},_addListeners:function(){var a=this;this.removeListeners();this.listeners.push(f(this.interactionService,"interaction_state_change",function(){a.interactionService.interactionState===a.interactionService.INTERACTION_STATES.INACTIVE?a._clearTaskList():a.interactionService.interactionState===a.interactionService.INTERACTION_STATES.INITIALIZING&&a._updateTaskList();if(a.interactionService.interactionState===a.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||
a.interactionService.interactionState===a.interactionService.INTERACTION_STATES.GRADING||a.interactionService.interactionState===a.interactionService.INTERACTION_STATES.COMPLETE)a.clearHintWidget(),a.clearSolutionWidget();a._updateTaskContainerStatus()}));this.listeners.push(f(this.interactionService,this.interactionService.EVENTS.USER_WANTS_TO_SEE_HINT,function(){a._displayDefaultHint()}));this.listeners.push(f(this.interactionService,this.interactionService.EVENTS.USER_WANTS_TO_SEE_SOLUTION,function(){"simulink"===
a.interactionService.currentTask.type&&a._displayEmbeddedSolution()}));this.listeners.push(f(this.interactionService,this.interactionService.EVENTS.DISPLAY_TASK,function(b){(b=a._taskList[b-1])&&a.taskNavigator.goToTask(b)}));this.listeners.push(f(this.interactionService,this.interactionService.EVENTS.USER_WANTS_TO_MOVE_TO_NEXT_SECTION,function(){a.messageServiceInterface.publishMessage({type:"toolEventCode",message:r.COURSE.NEXT_SECTION})}))},removeListeners:function(){this.listeners.forEach(function(a){a.remove()});
this.listeners=[]},_updateTaskContainerStatus:function(){var a,b,c,d;if(d=this.interactionService.getTasks())for(a=0;a<d.length;a++)if(b=d[a],c=this._taskList[a])switch(e.remove(c.domNode,"activeTask"),e.remove(c.domNode,"inactiveTask"),e.remove(c.domNode,"notYetReachedTask"),b.getStatus()){case b.STATUS.ACTIVE:e.add(c.domNode,"activeTask");this.taskNavigator.goToTask(c);break;case b.STATUS.INACTIVE:e.add(c.domNode,"inactiveTask");break;case b.STATUS.NOTYETREACHED:e.add(c.domNode,"notYetReachedTask")}},
_updateTaskList:function(){var a=this.interactionService.getTasks(),b,c,d;for(c=0;c<a.length;c++)b=new s({task:a[c],interactionService:this.interactionService,actionService:this.actionService,taskActionService:this.taskActionService}),d=new m({task:a[c],interactionService:this.interactionService,actionService:this.actionService,taskActionService:this.taskActionService}),this._taskWidgets[a[c].taskNumber]=b,c===a.length-1?(d=this.taskNavigator.addTask(b,u.furtherPracticeText,d),b.setLastTask(!0),this._taskList.push(d)):
this._taskList.push(this.taskNavigator.addTask(b,u.taskText+" "+(c+1),d));this.taskNavigator.startup()},getWidgetForTask:function(a){return this._taskWidgets[a.taskNumber]},_displayDefaultHint:function(){this.clearHintWidget();var a=this.interactionService.currentTask;this.hintWidget=new p({interactionService:this.interactionService});this.getWidgetForTask(a).addWidget(this.hintWidget);this._reformatContent()},clearHintWidget:function(){this.hintWidget&&this.hintWidget.destroy()},_displayEmbeddedSolution:function(){this.clearSolutionWidget();
var a=this.interactionService.currentTask;this.solutionWidget=new n({interactionService:this.interactionService});this.getWidgetForTask(a).addWidget(this.solutionWidget);this._reformatContent()},clearSolutionWidget:function(){this.solutionWidget&&this.solutionWidget.destroy()},_reformatContent:function(){this.emit(r.CONTENT.REFORMAT)}})})},"academyinteractions/tasks/TaskActionProvider":function(){define("dojo/_base/declare dojo/_base/lang dojo/on academyinteractions/actions/LearningActionIdConstants academyinteractions/actions/LearningActions mw-log/Log".split(" "),
function(g,l,d,e,f,h){return g([],{constructor:function(c){h.assert(c.interactionService,"Must supply interactionService");h.assert(c.taskActionService,"Must supply actionService");this.interactionService=c.interactionService;this.taskActionService=c.taskActionService;this.taskActionService.loadActions(f.actions)},updateActions:function(c){var b=this,a;this.taskActionService&&(a=this._getSubmitButtonStatus(c),this.taskActionService.updateAction(e.SUBMIT,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,
callback:l.hitch(this,this.interactionService.userWantsToSubmit)}),a=this._getResetLinkStatus(c),this.taskActionService.updateAction(e.RESET,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,this.interactionService.userWantsToReset)}),a=this._getModalWindowLinkStatus(c),this.taskActionService.updateAction(e.MODAL_WINDOW,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction}),a=this._getHelpLinkStatus(c),this.taskActionService.updateAction(e.HELP_LINK,
{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction}),a=this._getNextTaskButtonStatus(c),this.taskActionService.updateAction(e.NEXT_TASK,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,function(){b.interactionService.resetToQuestionNumber(b.interactionService.currentTaskNumber+1)})}),a=this._getHintButtonStatus(c),this.taskActionService.updateAction(e.HINT,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,
this.interactionService.userWantsToSeeHint)}),a=this._getGetSolutionButtonStatus(c),this.taskActionService.updateAction(e.GET_SOLUTION,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,this.interactionService.userWantsToSkip)}),a=this._getSeeSolutionButtonStatus(c),this.taskActionService.updateAction(e.SEE_SOLUTION,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,this.interactionService.userWantsToSeeSolution)}),a=
this._getGoToTaskButtonStatus(c),this.taskActionService.updateAction(e.GO_TO_TASK,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,function(){b.interactionService.resetToQuestionNumber(c.taskNumber)})}),a=this._getNextSectionButtonStatus(c),this.taskActionService.updateAction(e.NEXT_SECTION,{enabled:a.enabled,visible:a.visible,isCallToAction:a.isCallToAction,callback:l.hitch(this,this.interactionService.userWantsToMoveToNextSection)}))},_getSubmitButtonStatus:function(c){var b=
!1,a=!0,d=!1,d=this._getNextTaskButtonStatus(c);if(this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE)b=!0;c.getStatus()!==c.STATUS.ACTIVE&&(a=b=!1);b=b&&!c.isActionDisabledForTask(e.SUBMIT);a=a&&!c.isActionHiddenForTask(e.SUBMIT);
d=b&&a&&!d.isCallToAction;return{enabled:b,visible:a,isCallToAction:d}},_getResetLinkStatus:function(c){var b=!1,a=!0,d=!1,d=this._getNextTaskButtonStatus(c);if(this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE)b=!0;c.getStatus()!==
c.STATUS.ACTIVE&&(a=b=!1);b=b&&!c.isActionDisabledForTask(e.RESET);a=a&&!c.isActionHiddenForTask(e.RESET);d=b&&a&&!d.isCallToAction;return{enabled:b,visible:a,isCallToAction:d}},_getModalWindowLinkStatus:function(c){var b=!1,a=!1,d=this.interactionService.currentTask;if(this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionService.interactionState===
this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE)b=!0;c.getStatus()!==c.STATUS.ACTIVE&&(a=b=!1);d&&(d.taskNumber===c.taskNumber&&c.supportingInfo)&&(a=!0);b=b&&!c.isActionDisabledForTask(e.MODAL_WINDOW);return{enabled:b,visible:a,isCallToAction:!1}},_getHelpLinkStatus:function(c){var b=!1,a=!1,d=this.interactionService.currentTask;if(this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===
this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE)b=!0;c.getStatus()!==c.STATUS.ACTIVE&&(a=b=!1);d&&(d.taskNumber===c.taskNumber&&this.interactionService.opts.taskHelpLink)&&(a=!0);b=b&&!c.isActionDisabledForTask(e.HELP_LINK);return{enabled:b,visible:a,isCallToAction:!1}},_getNextTaskButtonStatus:function(c){var b=!1,a=!0,d=this.interactionService.getNextTask(c);
if(this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE)b=!0;c.getStatus()!==c.STATUS.ACTIVE&&(a=b=!1);d?d.getStatus()===c.STATUS.NOTYETREACHED&&(a=b=!1):a=b=!1;b=b&&!c.isActionDisabledForTask(e.NEXT_TASK);a=a&&!c.isActionHiddenForTask(e.NEXT_TASK);
return{enabled:b,visible:a,isCallToAction:b&&a}},_getHintButtonStatus:function(c){var b=!1,a=!1;c&&c.hint&&(a=b=!0);c.getStatus()!==c.STATUS.ACTIVE&&(a=b=!1);b=b&&!c.isActionDisabledForTask(e.HINT);a=a&&!c.isActionHiddenForTask(e.HINT);return{enabled:b,visible:a,isCallToAction:!1}},_getSeeSolutionButtonStatus:function(c){var b=!0,a=this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.GRADING||this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.AWAITING_MOVE_TO_NEXT_QUESTION||
this.interactionService.interactionState===this.interactionService.INTERACTION_STATES.ALLOWING_USER_TO_PONDER_RESPONSE;c.getStatus()!==c.STATUS.ACTIVE&&(b=a=!1);a=a&&!c.isActionDisabledForTask(e.SEE_SOLUTION);b=b&&!c.isActionHiddenForTask(e.SEE_SOLUTION);return{enabled:a,visible:b,isCallToAction:!1}},_getGetSolutionButtonStatus:function(c){return{enabled:!0,visible:!1,isCallToAction:!1}},_getGoToTaskButtonStatus:function(c){var b=!1,a=!1;c.getStatus()===c.STATUS.INACTIVE&&(a=b=!0);b=b&&!c.isActionDisabledForTask(e.GO_TO_TASK);
a=a&&!c.isActionHiddenForTask(e.GO_TO_TASK);return{enabled:b,visible:a,isCallToAction:!1}},_getNextSectionButtonStatus:function(c){var b=!1,a=!1;this.interactionService.isLastTask(c)&&(a=b=!0);b=b&&!c.isActionDisabledForTask(e.NEXT_SECTION);a=a&&!c.isActionHiddenForTask(e.NEXT_SECTION);return{enabled:b,visible:a,isCallToAction:!1}}})})},"academyinteractions/actions/LearningActionIdConstants":function(){define([],function(){return{SUBMIT:"motw.learning.submit",HINT:"motw.learning.hint",RESET:"motw.learning.reset",
GET_SOLUTION:"motw.learning.getSolution",SEE_SOLUTION:"motw.learning.seeSolution",GO_TO_TASK:"motw.learning.goToTask",NEXT_SECTION:"motw.learning.nextSection",NEXT_TASK:"motw.learning.nextTask",MODAL_WINDOW:"motw.learning.modalWindow",HELP_LINK:"motw.learning.helplink"}})},"academyinteractions/actions/LearningActions":function(){define(["academyinteractions/actions/LearningActionIdConstants","mw-log/Log","dojo/i18n!academyinteractions/l10n/nls/academyinteractions"],function(g,l,d){var e={};e.actions=
[{id:g.SUBMIT,enabled:!1,text:d.submitText,description:d.submitDesc,icon:"learningSubmit",callback:function(){l.warn("Action "+g.SUBMIT+" doesn't do anything yet.")}},{id:g.RESET,enabled:!1,text:d.resetText,description:d.resetDesc,icon:"learningReset",callback:function(){l.warn("Action "+g.RESET+" doesn't do anything yet.")}},{id:g.MODAL_WINDOW,enabled:!1,text:d.modalWindowLinkText,description:d.modalWindowLinkDesc,icon:"learningModalWindow",callback:function(){l.warn("Action "+g.MODAL_WINDOW+" doesn't do anything yet.")}},
{id:g.HELP_LINK,enabled:!1,text:d.quickReference,description:d.quickReference,icon:"learningModalWindow",callback:function(){l.warn("Action "+g.HELP_LINK+" doesn't do anything yet.")}},{id:g.HINT,enabled:!1,text:d.hintText,description:d.hintDesc,icon:"learningHint",callback:function(){l.warn("Action "+g.HINT+" doesn't do anything yet.")}},{id:g.GET_SOLUTION,enabled:!1,text:d.getSolutionText,description:d.getSolutionDesc,icon:"learningGetSolution",callback:function(){l.warn("Action "+g.GET_SOLUTION+
" doesn't do anything yet.")}},{id:g.SEE_SOLUTION,enabled:!1,text:d.seeSolutionText,description:d.seeSolutionDesc,icon:"learningGetSolution",callback:function(){l.warn("Action "+g.SEE_SOLUTION+" doesn't do anything yet.")}},{id:g.GO_TO_TASK,enabled:!1,text:d.tryAgainText,description:d.tryAgainDesc,icon:"learningGoToTask",callback:function(){l.warn("Action "+g.GO_TO_TASK+" doesn't do anything yet.")}},{id:g.NEXT_SECTION,enabled:!1,text:d.nextSectionText,description:d.nextSectionDesc,icon:"learningNextSection",
callback:function(){l.warn("Action "+g.NEXT_SECTION+" doesn't do anything yet.")}},{id:g.NEXT_TASK,enabled:!1,text:d.nextTaskText,description:d.nextTaskDesc,icon:"learningNextTask",callback:function(){l.warn("Action "+g.NEXT_TASK+" doesn't do anything yet.")}}];return e})},"academyinteractions/display/TaskNavigator":function(){define("dojo/_base/declare dojo/query dojo/dom dojo/on dijit/TitlePane dijit/layout/ContentPane dojo/dom-class dojo/dom-construct".split(" "),function(g,l,d,e,f,h,c,b){return g(h,
{_openCloseDuration:200,activeTask:null,constructor:function(a){this._currentTask=null;this.interactionService=a.interactionService;this.taskActionProvider=a.taskActionProvider;this._taskList=[];this._taskQuickLinks=[];this.inherited(arguments)},postCreate:function(a){this.inherited(arguments);c.add(this.domNode,"taskNavigator");this._refreshListeners();this._addInteractionServiceListeners()},destroy:function(a){this._refreshListeners();this.inherited(arguments)},_updateActions:function(){var a,b;
this.activeTask&&(this.taskActionProvider.updateActions(this.activeTask),this.activeTask.getStatus()===this.activeTask.STATUS.ACTIVE?this.interactionService.emit(this.interactionService.EVENTS.VIEWING_TASK,{isActive:!0}):this.interactionService.emit(this.interactionService.EVENTS.VIEWING_TASK,{isActive:!1}));if(this._taskList)for(a=0;a<this._taskList.length;a++)b=this._taskList[a],b.content.updateButtonStatuses(),b=this._taskQuickLinks[a],b.updateLinkStatuses()},_addInteractionServiceListeners:function(){var a=
this;this._temporaryListeners.push(e(a.interactionService,"interaction_state_change",function(){a._updateActions()}));this._temporaryListeners.push(e(a.interactionService,"response_state_change",function(){a._updateActions()}));this._temporaryListeners.push(e(a.interactionService,"skip_state_change",function(){a._updateActions()}))},_refreshListeners:function(){this._temporaryListeners&&this._temporaryListeners.forEach(function(a){a.remove()});this._temporaryListeners=[]},addTask:function(a,c,d){var h=
this,g=new f({title:"\x3cspan class\x3d'taskTitle'\x3e"+c+"\x3c/span\x3e",content:a,open:!1,baseClass:"titlePane",duration:this._openCloseDuration});b.place(d.domNode,g.titleBarNode,"first");this._temporaryListeners.push(e(g.titleBarNode,"click",function(a){h._makeActiveTask(g)}));this.addChild(g);this._taskList.push(g);this._taskQuickLinks.push(d);this.resize();return g},goToTask:function(a){this._currentTask=a;a.get("open")||a.toggle();this._makeActiveTask(a);this._scrollToActiveTask()},_makeActiveTask:function(a){this._closeAllTitlePanesExcept(a);
a.content&&a.content.task&&(this.activeTask=a.content.task,this._updateActions())},_closeAllTitlePanesExcept:function(a){var b,c;for(c=0;c<this._taskList.length;c++)b=this._taskList[c],(b=b!==a)&&this._taskList[c].get("open")&&this._taskList[c].toggle()},_scrollToActiveTask:function(){var a=null,b=this._currentTask,c=this.domNode.parentNode;if(b){var d=c.offsetHeight,e=c.scrollTop,f=e+d,h=b.offsetTop,b=b.offsetTop+b.offsetHeight;h<e?(a=h-35,0>a&&(a=0)):b>f&&(a=b-d+35);if(null!==a)var t=(a-e)/20,g=
0,l=window.setInterval(function(){g++;c.scrollTop+=t;20===g&&window.clearInterval(l)},12.5)}}})})},"academyinteractions/display/TaskQuickLinks":function(){define("dojo/_base/declare dojo/query dojo/dom dojo/on dijit/_WidgetBase dojo/dom-class dojo/dom-construct dojo/dom-attr dojo/dom-style academyinteractions/actions/LearningActionIdConstants dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),function(g,l,d,e,f,h,c,b,a,k,q){return g(f,{constructor:function(a){this.title=a.title;
this.interactionService=a.interactionService;this.taskActionService=a.taskActionService;this.task=a.task;this.taskNumber=this.task.taskNumber;this.inherited(arguments)},postCreate:function(a){this.inherited(arguments);this._addLinks();this._addListeners()},destroy:function(a){this._resetListeners();this.inherited(arguments)},_addLinks:function(){this.resetLink=c.create("a",{"class":"resetLink",id:"resetLinkID",innerHTML:q.resetText})},_addListeners:function(){var a=this;this._resetListeners();this._listeners.push(e(this.interactionService,
"interaction_state_change",function(){a.updateLinkStatuses()}));this._listeners.push(e(this.interactionService,"response_state_change",function(){a.updateLinkStatuses()}));this._listeners.push(e(a.resetLink,"click",function(b){b.stopPropagation?b.stopPropagation():b.cancelBubble=!0;a.interactionService.userWantsToReset()}))},_resetListeners:function(){this._listeners&&this._listeners.forEach(function(a){a.remove()});this._listeners=[]},updateLinkStatuses:function(){this._updateResetLinkStatus()},
_updateResetLinkStatus:function(){var a=this.taskActionService.getAction(k.RESET);this.interactionService.currentTaskNumber!==this.taskNumber&&(a.visible=!1);this._updateLink(this.resetLink,a)},_updateLink:function(c,d){d.enabled?b.remove(c,"disabled"):b.set(c,"disabled","");d.visible?a.set(c,"display",""):a.set(c,"display","none");d.isCallToAction?h.add(c,"callToAction"):h.remove(c,"callToAction")}})})},"academyinteractions/display/TaskDisplay":function(){define("dojo/_base/declare dojo/query dojo/dom dojo/on dojo/touch dojo/_base/fx dijit/TitlePane dijit/layout/ContentPane dojo/dom-class dojo/dom-construct dojo/dom-attr dojo/dom-style academyinteractions/display/ModalOverlay academyinteractions/actions/LearningActionIdConstants dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),
function(g,l,d,e,f,h,c,b,a,k,q,m,s,p,n){return g(b,{constructor:function(a){this.task=a.task;this.interactionService=a.interactionService;this.taskActionService=a.taskActionService;this.interactionWidget=a.interactionWidget;this.contentFormatter=a.contentFormatter;this.inherited(arguments)},postCreate:function(b){this.inherited(arguments);a.add(this.domNode,"taskItem");this._addTaskAndInfo();this._addButtons();this._addListeners()},destroy:function(a){this._destroyModalWindow();this._resetListeners();
this.inherited(arguments)},setLastTask:function(b){b?a.add(this.domNode,"lastTask"):a.remove(this.domNode,"lastTask")},_addTaskAndInfo:function(){var a,b;b=k.create("div",{"class":"taskAndInfo"},this.domNode,"last");a=k.create("div",{"class":"supportingInfoDiv"},b,"last");this.modalWindowLink=k.create("a",{"class":"supportingInfo",innerHTML:"\x3cspan\x3e"+n.modalWindowLinkText+"\x3cspan class\x3d'icon-link-external icon_24'\x3e\x3c/span\x3e\x3c/span\x3e"},a,"last");this.task.background&&k.create("div",
{"class":"info",innerHTML:this.task.background},b,"last");a=k.create("div",{"class":"task",innerHTML:this.task.description},b,"last");this.task.nextTask&&k.create("div",{"class":"taskLabel",innerHTML:n.taskText},a,"first")},_addButtons:function(){this._buttonPane=new b({"class":"buttonPane"});var a=k.create("table",{"class":"buttonTable"},this._buttonPane.domNode),c=k.create("tr",{},a),a=k.create("td",{},c),c=k.create("td",{},c);this._linksDiv=new b({"class":"linksDiv"});this._buttonsDiv=new b({"class":"buttonsDiv"});
this._hintSolutionButtons=new b({"class":"hintSolutionButtons"});this._taskHelpLinkArea=new b({"class":"taskHelpLink"});this._scriptFunctionButtons=new b({"class":"scriptFunctionButtons"});this._inactiveButtons=new b({"class":"inactiveButtons"});this._nextTaskButtons=new b({"class":"nextTaskButtons"});this._lastTaskButtons=new b({"class":"lastTaskButtons"});this.hintButton=k.create("div",{"class":"linkBtn hintButton",innerHTML:n.hintText},this._hintSolutionButtons.domNode,"last");this.getSolutionButton=
k.create("div",{"class":"linkBtn skipButton",innerHTML:n.getSolutionText},this._hintSolutionButtons.domNode,"last");this.seeSolutionButton=k.create("div",{"class":"linkBtn skipButton",innerHTML:n.seeSolutionText},this._hintSolutionButtons.domNode,"last");this.resetButton=k.create("div",{"class":"linkBtn resetButton",id:"resetLinkID",innerHTML:n.resetText},this._hintSolutionButtons.domNode,"last");this.quickReference=k.create("a",{innerHTML:n.quickReference,target:"qrg","class":"linkBtn",href:this.interactionService.opts.taskHelpLink},
this._taskHelpLinkArea.domNode,"last");this.submitButton=k.create("button",{"class":"btn btn-sm btn_color_blue add_indent_5 submitButton",innerHTML:n.submitText},this._scriptFunctionButtons.domNode,"last");this.goToTaskButton=k.create("button",{"class":"btn btn-sm btn_color_blue add_indent_5 goToTaskButton",innerHTML:n.tryAgainText},this._inactiveButtons.domNode,"last");this.nextTaskButton=k.create("button",{"class":"btn btn-sm btn_color_blue add_indent_5 nextTaskButton",innerHTML:n.nextTaskText},
this._nextTaskButtons.domNode,"last");this.nextSectionButton=k.create("button",{"class":"btn btn-sm btn_color_blue add_indent_5 nextSectionButton",innerHTML:n.nextSectiongtText},this._lastTaskButtons.domNode,"last");this._linksDiv.addChild(this._hintSolutionButtons);this._linksDiv.addChild(this._taskHelpLinkArea);this._buttonsDiv.addChild(this._inactiveButtons);this._buttonsDiv.addChild(this._scriptFunctionButtons);this._buttonsDiv.addChild(this._nextTaskButtons);this._buttonsDiv.addChild(this._lastTaskButtons);
k.place(this._linksDiv.domNode,a);k.place(this._buttonsDiv.domNode,c);this.addChild(this._buttonPane)},_showModalWindow:function(){var a;this._destroyModalWindow();if((a=this.interactionService.currentTask)&&a.taskNumber===this.task.taskNumber&&this.task.supportingInfo)a=this._getAnimationTargetDomElement(),this.supportingInfoOverlay=new s({animationTargetDomElement:a}),this.supportingInfoPane=new b({"class":"lectureContent supportingInfo"}),k.place(this.supportingInfoPane.domNode,this.supportingInfoOverlay.contentDiv,
"last"),k.place(this.supportingInfoOverlay.domNode,this.interactionWidget._leftRightBorderContainer.domNode),this.supportingInfoPane.set("content",this.task.supportingInfo),this._formatContent(),this.supportingInfoOverlay.show()},addWidget:function(b){var c=null,d,e=this.domNode.childNodes;for(d=0;d<e.length;d++)e[d]&&a.contains(e[d],"taskHelpLink")&&(c=d),e[d]&&a.contains(e[d],"assessmentPane")&&(c=d);this.addChild(b,c)},_destroyModalWindow:function(){this.supportingInfoOverlay&&this.supportingInfoOverlay.destroy();
this.supportingInfoOverlay=null},_getAnimationTargetDomElement:function(){return l(".icon-link-external",this.modalWindowLink)[0]},_addListeners:function(){var a=this;this._resetListeners();this._listeners.push(e(this.interactionService,"interaction_state_change",function(){a.updateButtonStatuses()}));this._listeners.push(e(this.interactionService,"response_state_change",function(){a.updateButtonStatuses()}));this._listeners.push(e(this.interactionService,"skip_state_change",function(){a._updateGetSolutionButtonStatus()}));
this._listeners.push(e(this.interactionService,"struggling_state_change",function(){a._updateButtonHighlights()}));this._listeners.push(e(this.interactionService,"display_supporting_info",function(){a._showModalWindow()}));this._listeners.push(e(a.submitButton,f.press,function(b){a.interactionService.userWantsToSubmit()}));this._listeners.push(e(a.hintButton,f.press,function(b){a.interactionService.userWantsToSeeHint()}));this._listeners.push(e(a.getSolutionButton,f.press,function(b){a.interactionService.userWantsToSkip()}));
this._listeners.push(e(a.seeSolutionButton,f.press,function(b){b.ctrlKey&&b.shiftKey?a.interactionService.userWantsToSkip():a.interactionService.userWantsToSeeSolution()}));this._listeners.push(e(a.resetButton,f.press,function(b){a.interactionService.userWantsToReset()}));this._listeners.push(e(a.goToTaskButton,f.press,function(b){a.interactionService.resetToQuestionNumber(a.task.taskNumber)}));this._listeners.push(e(a.nextSectionButton,f.press,function(b){a.interactionService.userWantsToMoveToNextSection()}));
this._listeners.push(e(a.nextTaskButton,f.press,function(b){a.interactionService.resetToQuestionNumber(a.interactionService.currentTaskNumber+1)}));this._listeners.push(e(a.modalWindowLink,f.press,function(){a._showModalWindow()}))},_resetListeners:function(){this._listeners&&this._listeners.forEach(function(a){a.remove()});this._listeners=[]},_updateTaskStatus:function(){a.remove(this.domNode,"activeTask");a.remove(this.domNode,"inactiveTask");a.remove(this.domNode,"notYetReachedTask");switch(this.task.getStatus()){case this.task.STATUS.ACTIVE:a.add(this.domNode,
"activeTask");break;case this.task.STATUS.INACTIVE:a.add(this.domNode,"inactiveTask");break;case this.task.STATUS.NOTYETREACHED:a.add(this.domNode,"notYetReachedTask")}},updateButtonStatuses:function(){this._updateTaskStatus();this._updateSubmitButtonStatus();this._updateNextTaskButtonStatus();this._updateGoToTaskButtonStatus();this._updateHintButtonStatus();this._updateGetSolutionButtonStatus();this._updateSeeSolutionButtonStatus();this._updateResetButtonStatus();this._updateNextSectionButtonStatus();
this._updateModalWindowLinkStatus();this._updateTaskHelpLinkArea()},_updateTaskHelpLinkArea:function(){var a=this.taskActionService.getAction(p.HELP_LINK);this._updateLink(this.quickReference,a)},_updateSubmitButtonStatus:function(){var a=this.taskActionService.getAction(p.SUBMIT);this._updateButton(this.submitButton,a)},_updateNextTaskButtonStatus:function(){var a=this.taskActionService.getAction(p.NEXT_TASK);this._updateButton(this.nextTaskButton,a)},_updateHintButtonStatus:function(){var a=this.taskActionService.getAction(p.HINT);
this._updateLink(this.hintButton,a)},_updateGetSolutionButtonStatus:function(){var a=this.taskActionService.getAction(p.GET_SOLUTION);this._updateLink(this.getSolutionButton,a)},_updateSeeSolutionButtonStatus:function(){var a=this.taskActionService.getAction(p.SEE_SOLUTION);this._updateLink(this.seeSolutionButton,a)},_updateResetButtonStatus:function(){var a=this.taskActionService.getAction(p.RESET);this._updateLink(this.resetButton,a)},_updateGoToTaskButtonStatus:function(){var a=this.taskActionService.getAction(p.GO_TO_TASK);
this._updateButton(this.goToTaskButton,a)},_updateNextSectionButtonStatus:function(){var a=this.taskActionService.getAction(p.NEXT_SECTION);this._updateButton(this.nextSectionButton,a)},_updateModalWindowLinkStatus:function(){var a=this.taskActionService.getAction(p.MODAL_WINDOW);this._updateLink(this.modalWindowLink,a)},_updateButtonHighlights:function(){var a,b;a=this.interactionService.strugglingState===this.interactionService.STRUGGLING_STATES.STRUGGLING;b=this.interactionService.strugglingState===
this.interactionService.STRUGGLING_STATES.REALLY_STRUGGLING;this._hiliteHintButton(a||b);this._hiliteSeeSolutionButton(b)},_hiliteHintButton:function(b){b?a.add(this.hintButton,"academyGlow"):a.remove(this.hintButton,"academyGlow")},_hiliteSeeSolutionButton:function(b){b?a.add(this.seeSolutionButton,"academyGlow"):a.remove(this.seeSolutionButton,"academyGlow")},_updateButton:function(b,c){c.enabled?q.remove(b,"disabled"):q.set(b,"disabled","");c.visible?m.set(b,"display",""):m.set(b,"display","none");
c.isCallToAction?a.remove(b,"companion_btn"):a.add(b,"companion_btn")},_updateLink:function(a,b){b.enabled?q.remove(a,"disabled"):q.set(a,"disabled","");b.visible?m.set(a,"display",""):m.set(a,"display","none")},_formatContent:function(){this.interactionWidget.reformatContent()}})})},"academyinteractions/display/HintDisplay":function(){define("dojo/_base/declare dojo/_base/fx dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/html dojo/query dijit/layout/ContentPane dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),
function(g,l,d,e,f,h,c,b,a,k){return g([a],{constructor:function(a){this.interactionService=a.interactionService;this.inherited(arguments)},postCreate:function(){d.add(this.domNode,"hintMessage");e.create("div",{"class":"hintMessageHeader",innerHTML:k.hintText},this.domNode,"last");this.contentDiv=e.create("div",{"class":"hintMessageContents"},this.domNode,"last");this.interactionService.currentTask&&this.interactionService.currentTask.hint&&c.set(this.contentDiv,this.interactionService.currentTask.hint)}})})},
"academyinteractions/display/SimulinkSolutionDisplay":function(){define("dojo/_base/declare dojo/_base/fx dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/html dojo/query dijit/layout/ContentPane dojo/i18n!academyinteractions/l10n/nls/academyinteractions".split(" "),function(g,l,d,e,f,h,c,b,a,k){return g([a],{constructor:function(a){this.interactionService=a.interactionService;this.inherited(arguments)},postCreate:function(){d.add(this.domNode,"hintMessage");e.create("div",
{"class":"hintMessageHeader",innerHTML:k.seeSolutionHeader},this.domNode,"last");this.contentDiv=e.create("div",{"class":"hintMessageContents"},this.domNode,"last");this.interactionService.currentTask&&this.interactionService.currentTask.solution&&c.set(this.contentDiv,this.interactionService.currentTask.solution)}})})},"academyinteractions/tasks/SimulinkFreeTaskService":function(){define("dojo/_base/declare dojo/on dojo/Deferred dojo/Evented academyinteractions/Task academyinteractions/actions/LearningActionIdConstants".split(" "),
function(g,l,d,e,f,h){return g([e],{constructor:function(c){this.interactionService=c.interactionService;this.inherited(arguments)},enableTask:function(c){this._resetListeners();this.emit("enabled",c);this._addListeners(c)},disableTask:function(c){this.emit("disabled",c);this._resetListeners()},createTaskFromRawData:function(c){var b=c.data;c=new f({type:b.type,description:b.description,taskNumber:c.taskNumber,background:b.background,supportingInfo:b.supportingInfo,hint:b.hint});c.hideActionButtonForTask(h.SUBMIT);
c.disableActionForTask(h.SUBMIT);c.hideActionButtonForTask(h.HINT);c.disableActionForTask(h.HINT);c.hideActionButtonForTask(h.GET_SOLUTION);c.disableActionForTask(h.GET_SOLUTION);c.hideActionButtonForTask(h.SEE_SOLUTION);c.disableActionForTask(h.SEE_SOLUTION);c.hideActionButtonForTask(h.RESET);c.disableActionForTask(h.RESET);return c},_addListeners:function(c){var b=this;this._listeners.push(l(b.interactionService,"interaction_state_change",function(a){a===b.interactionService.INTERACTION_STATES.MOVING_TO_ANOTHER_QUESTION&&
(b.interactionService.clearResponse(),window.setTimeout(function(){b.interactionService.successfullyMovedToCurrentQuestion()},10))}))},_resetListeners:function(){this._listeners&&this._listeners.forEach(function(c){c.remove()});this._listeners=[]},transitionToTask:function(c){return this.saveTaskState(c)},saveTaskState:function(c){return this._noOp()},canResetToTask:function(c){return!1},resetToTask:function(c){this.canResetToTask(c)?c=this.transitionToTask(c):(c=new d,c.cancel(),c=c.promise);return c},
submitTask:function(c,b){return this._noOp()},_noOp:function(){var c=new d;c.resolve();return c.promise}})})},"academyinteractions/tasks/SimulinkTaskService":function(){define("dojo/_base/declare dojo/on dojo/Deferred dojo/Evented academyinteractions/functional/FunctionalUtils academyinteractions/Task academyinteractions/InteractionMessageQueue".split(" "),function(g,l,d,e,f,h,c){return g([e],{constructor:function(b){this.interactionService=b.interactionService;this.interactionMessageQueue=b.interactionMessageQueue;
this.matlabStateService=b.matlabStateService;this.inherited(arguments)},enableTask:function(b){this._resetListeners();this._addListeners(b)},disableTask:function(b){this._resetListeners()},createTaskFromRawData:function(b){var a=b.data;b=new h({type:"simulink",description:a.description,taskNumber:b.taskNumber,background:a.background,supportingInfo:a.supportingInfo,hint:a.hint});b.solution=a.solution;return b},_addListeners:function(b){var a=this;this._listeners.push(l(a.interactionService,"interaction_state_change",
function(c){if(c===a.interactionService.INTERACTION_STATES.GRADING||c===a.interactionService.INTERACTION_STATES.MOVING_TO_ANOTHER_QUESTION)a.interactionService.clearResponse(),c===a.interactionService.INTERACTION_STATES.MOVING_TO_ANOTHER_QUESTION&&a._addAssessmentBlock(b).then(function(){a._updateAssessmentPaneFigure(b)});c===a.interactionService.INTERACTION_STATES.EVALUATING_SUBMISSION&&a._submitUsingInteractionMessageQueue(b).then(function(){a._refreshAssessmentPane(b)})}));this._listeners.push(l(a.interactionService,
"user_wants_to_reset",function(){a._resetTask(b)}))},_resetListeners:function(){this._listeners&&this._listeners.forEach(function(b){b.remove()});this._listeners=[]},_addAssessmentBlock:function(b){var a=this,d=new c;d.addFEvalToQueue({"function":"LearningApplication.setupTask",arguments:[b.taskNumber],nargout:0,priority:1},function(b){a.interactionService.successfullyMovedToCurrentQuestion()});return d.flushQueue()},_updateAssessmentPaneFigure:function(b){b=new c;b.addFEvalToQueue({"function":"LearningApplication.updateAssessmentPane",
nargout:0,priority:1},function(a){});return b.flushQueue()},_refreshAssessmentPane:function(b){b=new c;b.addEvalToQueue({mcode:"learning.simulink.refreshSignalWindows;"});return b.flushQueue()},_resetTask:function(b){b=new c;b.addFEvalToQueue({"function":"LearningApplication.resetTask",nargout:0,priority:1},function(a){});return b.flushQueue()},_submitUsingInteractionMessageQueue:function(b){var a=this,d=null,e=new c;e.addFEvalToQueue({"function":"LearningApplication.submitTask",nargout:2,priority:1},
function(c){function e(a){return!0===a}d=c[0].results;Array.isArray(d[0])?d[0].every(e)?b.setResponse(!0,"",""):b.setResponse(!1,"",""):d[0]?b.setResponse(!0,"",""):b.setResponse(!1,"","");a.interactionService.successfullyProcessedSubmission()});return e.flushQueue()},canResetToTask:function(b){return!1}})})},"academyinteractions/functional/FunctionalUtils":function(){define(["dojo/Deferred","mw-log/Log"],function(g,l){var d=function(d,h,c){d&&d.then?d.then(function(b){e(h,c,b)},function(b){b&&b.stack&&
l.warn(b.stack);h.cancel(b)}):h.cancel("Invalid promise in sequence.")},e=function(e,h,c){if(!e.isFulfilled())if(h&&h[0])try{d(h[0](c),e,h.splice(1))}catch(b){b&&b.stack&&l.warn(b.stack),e.cancel(b)}else e.resolve(c)};return{chainPromises:function(d){var h=new g;e(h,d);return h}}})},"academyinteractions/SimulinkInteractionBuilder":function(){define(["dojo/_base/declare","dojo/Deferred","dojo/json","mw-academy-web/courseplayer/CoursePlayerUtil","dojo/request/xhr"],function(g,l,d,e,f){return g(null,
{interactionService:null,id:null,lessonPath:null,constructor:function(d){this.interactionService=d.interactionService;this.id=d.id;this.lessonPath=d.lessonPath},createInteractionDataFromID:function(){var d=this,c=document.getElementsByTagName("body")[0].getAttribute("data-content");f(c+d.id,{handleAs:"json"}).then(function(b){b=e.replaceTokens(b,d._getTokenReplacements());b.simulinkInteraction.id=d.id;d.interactionService.setInteractionData(b.simulinkInteraction,{fullPathToContent:c});d.interactionService.startInteraction()},
function(b){})},_getTokenReplacements:function(){return{lessonpath:this.lessonPath}}})})},"*now":function(g){g(['dojo/i18n!*preload*academyinteractions/nls/SimulinkTaskPaneApp*["ar","ca","cs","da","de","el","en-gb","en-us","es-es","fi-fi","fr-fr","he-il","hu","it-it","ja-jp","ko-kr","nl-nl","nb","pl","pt-br","pt-pt","ru","sk","sl","sv","th","tr","zh-tw","zh-cn","ROOT"]'])}}});
define("academyinteractions/SimulinkTaskPaneApp","dojo/_base/declare dojo/Deferred dojo/Evented dojo/on dojo/dom dojo/dom-construct dojo/html mw-actiondataservice/ActionDataService academyinteractions/InteractionService academyinteractions/SimulinkInteractionModule academyinteractions/tasks/SimulinkFreeTaskService academyinteractions/tasks/SimulinkTaskService academyinteractions/display/TaskNavigator academyinteractions/Task academyinteractions/tasks/TaskActionProvider academyinteractions/SimulinkInteractionBuilder academyinteractions/MessageServiceInterface academyinteractions/toolEventCodes mw-academy-web/lecture/SimpleContentFormatter".split(" "),function(g,
l,d,e,f,h,c,b,a,k,q,m,s,p,n,t,v,r,u){return g([],{requestData:{type:"toolEventCode",message:r.SIMULINK.REQUEST_COURSEMODELDATA},constructor:function(){var c=this._getQueryParams(document.location.search);c.debug&&c.endpoint&&this._createRemoteEndpoint(c.endpoint);this.taskActionService=new b;this.interactionService=new a;this.taskActionProvider=new n({taskActionService:this.taskActionService,interactionService:this.interactionService});this.taskNavigator=new s({interactionService:this.interactionService,
taskActionProvider:this.taskActionProvider});this.simulinkFreeTaskService=new q({interactionService:this.interactionService});this.messageServiceInterface=new v({subscribeChannel:"courseModelData",publishChannel:"courseModelRequest"});this.simulinkTaskService=new m({interactionService:this.interactionService});this.interactionService.registerTaskType("simulink",this.simulinkTaskService);this.interactionService.registerTaskType("free",this.simulinkFreeTaskService);this.topNavigator=h.create("div",
{id:"slTopNavigator"},"trainingApp","first");this.sectionHeaderDiv=h.create("div",{id:"slSectionHeader"},this.topNavigator);this.simulinkInteractionModule=new k({actionService:this.taskActionService,taskActionService:this.taskActionService,interactionService:this.interactionService,taskActionProvider:this.taskActionProvider,taskNavigator:this.taskNavigator});this._addListeners();this._publishAliveMessage();this._reparseHTML()},_addListeners:function(){var a=this;this._resetListeners();this._listeners.push(e(a.messageServiceInterface,
r.SIMULINK.SENT_COURSEMODELDATA,function(){if(!this.courseModelDataLoaded){var b=a.messageServiceInterface.getCourseModelData();c.set(a.sectionHeaderDiv,b.sectionHeaderText);a._loadAndStartInteraction(b.id,b.lessonPath);this.courseModelDataLoaded=!0}}));this._listeners.push(e(a.simulinkInteractionModule,r.CONTENT.REFORMAT,function(){a._reparseHTML()}))},_resetListeners:function(){this._listeners&&this._listeners.forEach(function(a){a.remove()});this._listeners=[]},_publishAliveMessage:function(){this.messageServiceInterface.publishMessage(this.requestData)},
_loadAndStartInteraction:function(a,b){this.jsonReader=new t({interactionService:this.interactionService,id:a,lessonPath:b});this.jsonReader.createInteractionDataFromID()},_getQueryParams:function(a){for(var b={},c,d=/[?&]?([^=]+)=([^&]*)/g;c=d.exec(a);)b[decodeURIComponent(c[1])]=decodeURIComponent(c[2]);return b},_createRemoteEndpoint:function(a){require("mw-remote/Remote").setWorkerEndpoint(a,"slTaskPane")},_reparseHTML:function(){(new u).format()}})});
//# sourceMappingURL=SimulinkTaskPaneApp.js.map